Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

optionator

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

optionator

option parsing and help generation

  • 0.8.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28M
decreased by-42.26%
Maintainers
1
Weekly downloads
 
Created

What is optionator?

The optionator npm package is used for parsing command-line options. It allows developers to easily define and manage the options their command-line interface (CLI) tools accept. It provides a declarative way to specify the options, their types, default values, and help descriptions. It also automatically generates help text based on the option definitions.

What are optionator's main functionalities?

Option Parsing

This code sample demonstrates how to define command-line options and parse them using optionator. It also shows how to display help text if the user passes the 'help' option.

{"const optionator = require('optionator')({ prepend: 'Usage: prog [options]', append: 'Version 1.0.0', options: [{ option: 'help', alias: 'h', type: 'Boolean', description: 'Displays help' },{ option: 'force', alias: 'f', type: 'Boolean', default: 'false', description: 'Force operation' },{ option: 'verbose', type: 'Boolean', default: 'false', description: 'Verbose output' }] }); const options = optionator.parse(process.argv); if (options.help) { console.log(optionator.generateHelp()); process.exit(); }}

Help Text Generation

This code sample shows how to automatically generate and display help text for the defined command-line options.

{"const optionator = require('optionator')({ prepend: 'Usage: prog [options]', append: 'Version 1.0.0', options: [{ option: 'help', alias: 'h', type: 'Boolean', description: 'Displays help' }] }); console.log(optionator.generateHelp());}

Other packages similar to optionator

Keywords

FAQs

Package last updated on 06 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc